# Importing the required libraries.
import pyshorteners
from colorama import Fore # this module for font color

# Taking input from the user.
url = input("Enter URL: ")

# exception handling 
try:
    # Creating an instance of the pyshorteners library.
    shortener = pyshorteners.Shortener()

    # Shortening the URL using TinyURL.
    shortened_URL = shortener.tinyurl.short(url)

    # Displaying the shortened URL.
    print(f"Shortened URL: {shortened_URL}")
except(Exception) as e:
    # this code runes on any error is generated by user
    print(Fore.RED, "Enter Valid URL format", Fore.RESET)

